package com.lwz.startdemo

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import androidx.lifecycle.ViewModel

/**
 * @Description: 类作用描述
 * @Author: chad
 * @CreateDate: 2025/5/15 12:54
 * @Version: 1.0
 */
class StudentViewModel(stu: Student) :ViewModel(){
    private val student = MutableLiveData<Student>()

    val name:LiveData<String> = Transformations.map(student){user->
        user.name
    }

    init {
        student.value = stu
    }

    fun getStu(){
        student.value = Repository.getStudent().value
    }



}